<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务单反审核" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		parent.ClosePop();
	}
	function doExamine(id){
		ShowConfirm('确认框','确定反审核吗？',340,80,"doExamineCallBack("+id+")");
	}
	function doExamineCallBack(id){
		if(popRetVal!=null){
			window.location="BusinessBillExamine.ihtm?bill_id="+id+"&flag=UNEXA";
		}
	}
	function doDownload(id,fileName,sourceName){
		var xmlHttp=createXMLHttpRequest();
		xmlHttp.open("GET", "/FileDownloadLog.ihtm?id="+id);
		xmlHttp.onreadystatechange = function(){
			doDownloadCallback(xmlHttp,fileName,sourceName);
		};
		xmlHttp.send(null);
	}
	function doDownloadCallback(xmlHttp,fileName,sourceName){
    	if (xmlHttp.readyState == 4) {
      		if (xmlHttp.status == 200) {
      			var resTxt=xmlHttp.responseText;
      			if(resTxt=="NO_LOGIN"){
      				ShowAlert('提示框','你还没登录或已经超时，请重新登录。',200,100);
      			}else if(resTxt=="OK"){
      				window.location="/FileDownload.ihtm?file_name="+encodeURIComponent(fileName)+"&source_name="+encodeURIComponent(sourceName);
      			}
			}
		}
	}
	function doInit(){
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet modal-dialog" style=" padding-top:10px;text-align:center;">
<div class="sheet-main" id="bodyDiv" style="width:860px;text-align:left;">
	<div class="sheet-list" style="width:100%">
    	<div class="modal-main search-business">
			<div style="width:100%;">
	 			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
	 				<tr>
	 					<td style="width:33%" rowspan="2"></td>
	 					<td style="width:33%;text-align:center" rowspan="2"><h2>业务单反审核</h2></td>
	 					<td style="width:34%" class="tr">
	 						编号：${record.businessBill.billCode}
	 					</td>
	 				</tr>
	 				<tr>
	 					<td class="tr">订货日期：<fmt:formatDate value="${record.businessBill.orderDate}" pattern="yyyy-MM-dd HH:mm"/></td>
	 				</tr>
	 			</table>
	 			
	 			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
				    <tr>
	 					<td class="InfoTitleDivider"></td>
	 				</tr>
				</table>
	 			
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
					<tr>
				      	<th style="width:6%">客户：</th>
				      	<td style="width:26%">${record.clientName}<span class="lbClientNote">${record.clientLevel}</span></td>
				      	<th style="width:8%">联系人：</th>
				     	<td style="width:16%">${record.businessBill.linkman}</td>
				     	<th style="width:6%">电话：</th>
				     	<td style="width:16%">${record.businessBill.phone}
				    	<td class="tr" style="width:22%">合同号：${record.businessBill.contractCode}</td>
				    </tr>
				</table>
				
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
				    <tr>
	 					<td class="InfoTitleDivider"></td>
	 				</tr>
				</table>
				
				<%@ include file="../inc/BusinessBillItemList.jsp"%>		
				
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
				    <tr>
	 					<td class="InfoTitleDivider"></td>
	 				</tr>
				</table>
				
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-a2 BillElseInfo">
					<tr>
						<th>业务来源：</th>
				    	<td>${record.businessBill.introducerName}</td>
						<th>安装要求：</th>
				      	<td>${record.businessBill.setupRequire}</td>
						<th>合计金额：</th>
				      	<td >${record.businessBill.favCost+record.businessBill.cost}</td>
					</tr>
					<tr>
						<th>部门：</th>
				      	<td >${record.departmentName}</th>
						<th>提货要求：</th>
				      	<td >${record.businessBill.ladingRequire}</td>
						<th>优惠金额：</th>
				     	<td >${record.businessBill.favCost}</td>
					</tr>
					<tr>
						<th>业务员：</td>
				      	<td >${record.businessBill.managerName}</td>
						<th>交货日期：</th>
				    	<td ><c:if test="${record.businessBill.deliverDate!=null}"><fmt:formatDate value="${record.businessBill.deliverDate}" pattern="yyyy-MM-dd HH:mm"/></c:if></td>
						<th>折后金额：</td>
				     	<td>${record.businessBill.cost}</td>
					</tr>
					<tr>
						<th>跟单员：</td>
				      	<td >${record.businessBill.followerNameStr}</td>
				      	<th>送货地址：</th>
				    	<td >${record.businessBill.address}</td>
				    	<th>预付款：</th>
				      	<td >${record.businessBill.imprest}</td>
				    </tr>
					<tr>
						<td colspan="4" style="text-align:center"><div class="InfoDetailDivider"></div></td>
						<th>付款方式：</th>
				      	<td >${record.payModeName}</td>
					</tr>
					<tr>
						<th>设计类型：</th>
				      	<td >
				      		<c:if test="${record.businessBill.designType=='SELF'}">公司设计</c:if>
				      		<c:if test="${record.businessBill.designType=='CLIENT'}">客户来稿</c:if>
				      	</th>
				      	<th>摘要：</th>
				      	<td >${record.businessBill.content}</td>
				      	<th>收款账户：</th>
				      	<td >${record.bankAccountName}</td>
				    </tr>
					<tr>
				    	<th>设计员：</td>
				      	<td >${record.businessBill.designerNameStr}</td>
						<th>备注：</th>
				      	<td >${record.businessBill.mark}</td>
						<th>结账日期：</th>
				    	<td ><c:if test="${record.businessBill.checkDate!=null}"><fmt:formatDate value="${record.businessBill.checkDate}" pattern="yyyy-MM-dd"/></c:if></td>
				    </tr>
				</table>

				<c:if test="${fn:length(record.accessories)>0}">
			
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
				    <tr>
	 					<td class="InfoTitleDivider"></td>
	 				</tr>
				</table>
			
				<div class="table-list">	
				<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%" >
					<tr>
						<th width="26%">文件</th>
						<th width="26%">资料路径</th>
						<th width="18%">文件说明</th>
						<th width="10%">上传人</th>
						<th width="14%">上传时间</th>
						<th width="6%">操作</td>
					</tr>
					<c:forEach var="item" items="${record.accessories}">
					<tr>
						<td >
							<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="${item.fileName}" target="_blank">${item.sourceName}</a></c:if>
							<c:if test="${item.fileName==null || item.fileName==''}">${item.sourceName}</c:if>
						</td>
						<td >${item.customPath}</td>
						<td >${item.mark}</td>
						<td >${item.createrName}</td>
						<td ><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td >
							<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="javascript:doDownload('${item.id}','${item.fileName}','${item.sourceName}');">下载</a></c:if>
							<c:if test="${item.fileName==null || item.fileName==''}">下载</c:if>
						</td>
					</tr>
					</c:forEach>
				</table>
				</div>
				</c:if>

				<div class="blank12">&nbsp;</div>
				<p class="give">
					<span>开单人：${record.businessBill.createrName} <c:if test="${record.businessBill.createTime!=null}"><fmt:formatDate value="${record.businessBill.createTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></span>
					<span>审核人：<c:if test="${record.businessBillExt.examinerId!=0}">${record.businessBillExt.examinerName} <c:if test="${record.businessBillExt.examineTime!=null}"><fmt:formatDate value="${record.businessBillExt.examineTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></c:if></span>
					<span>结清：${record.businessBillExt.closerName} <fmt:formatDate value="${record.businessBillExt.closeTime}" pattern="yyyy-MM-dd HH:mm"/></span>
					<span>最后打印：<c:if test="${record.businessBillExt.lastPrinter!=null && record.businessBillExt.lastPrinter!=''}">${record.businessBillExt.lastPrinter} / 已打印${record.businessBillExt.printNum}次</c:if></span>
					<span>修改人：<c:if test="${record.businessBill.modifierId!=0}">${record.businessBill.modifierName} <fmt:formatDate value="${record.businessBill.modifyTime}" pattern="yyyy-MM-dd HH:mm"/></c:if></span>
					<span>单据帐套：${record.tallySetName}</span>
				</p>
	  			</div>
	  		</div>
  		</div>
  	</div>
	<div class="modal-buttom">
		<c:if test="${record.businessBillExt.examined=='Y' && record.businessBillExt.closed=='N'}">
			<input type="button" class="buttom-a" value=" 反审核 " onClick="doExamine('${record.businessBill.id}');">
		</c:if>
		<input type="button" class="buttom-a" value=" 退 出 " onClick="doCancel();">						
	</div>  
</div>
</body>
</html>